package cn.com.fabric.sdk;

import static cn.com.fabric.sdk.PathConf.chaincodeLocation;

/**
 * <h3>sdkdemo</h3>
 * <p>入口函数</p>
 *
 * @author : sugar without coffee
 * @date : 2020-04-22 14:22
 **/
public class Main {

    public static void main(String[] args) {
        String chaincodeName = "adminInfo";
        String chaincodeVersion = "1.0";
        String[] initArgsInvoke1 =
                {"test",
                        "{\"Key\":\"" + "1" + "\"," +
                                "\"ValueA\":\"" + "val1" + "\"," +
                                "\"ValueB\":\"" + "val2" + "\"}" };
        String[] initArgsInvoke2 =
                {"test",
                        "{\"AdminId\":\"" + "10000" + "\"," +
                                "\"AdminPassword\":\"" + "password" + "\"}" };
        String[] initArgsQuery = {"test"};
        // 安装链码
        //FabricSDK.installChaincode(chaincodeVersion,chaincodeLocation,chaincodeName);
        // 实例化链码
        //FabricSDK.instantiated(chaincodeName,chaincodeVersion);
        // 升级链码（需要先安装再升级）
        //FabricSDK.upgradeChaincode(chaincodeName,chaincodeVersion);
        // 触发链码
        //FabricSDK.invoke(chaincodeName,initArgsInvoke1);
        // 查询链码最新记录
        //System.out.println(FabricSDK.queryChaincode(chaincodeName,initArgsQuery));
        // 查询链码所有记录
        //System.out.println(FabricSDK.queryAllChaincode(chaincodeName,initArgsQuery));
    }


}
